/**
 * 
 */
package hu.gbalage.owlforms.api.data;

import hu.gbalage.owlforms.api.Field;

import java.net.URI;
import java.util.List;

/**
 * Contains data inserted by the user into a field of a
 * form
 * @author Grill Balazs (balage.g@gmail.com)
 *
 */
public interface FieldData{

	/**
	 * @return the form data
	 */
	public FormData getFormData();
	
	/**
	 * @return the field
	 */
	public Field getField();
	
	/**
	 * @return list of the inserted values
	 */
	public List<FieldValue> listValues();
	
	/**
	 * Create a new FieldValue, insert to the FieldData and
	 * return it.
	 * @return
	 */
	public FieldValue insertValue(URI type);
	
	/**
	 * Insert a previously created value. Note that this method can fail if
	 * the given value is not acceptable by the underlying field. In that case this method
	 * won't has any effect. 
	 * @param value
	 */
	public void insertValue(FieldValue value);
	
	/**
	 * Insert a composite value. 
	 * @param data
	 */
	public void insertCompositeValue(FormData data);
	
}
